{
  "author": "@4ian",
  "category": "Movement",
  "extensionNamespace": "",
  "fullName": "Stay On Screen",
  "helpPath": "",
  "iconUrl": "",
  "name": "StayOnScreen",
  "previewIconUrl": "https://resources.gdevelop-app.com/assets/Icons/monitor-screenshot.svg",
  "shortDescription": "Force the object to stay visible on the screen by setting back its position inside the viewport of the camera.",
  "version": "0.0.2",
  "description": "Force the object to stay visible on the screen by setting back its position inside the viewport of the camera.",
  "origin": {
    "identifier": "StayOnScreen",
    "name": "gdevelop-extension-store"
  },
  "tags": [
    "positioning",
    "camera",
    "screen"
  ],
  "authorIds": [
    "wWP8BSlAW0UP4NeaHa2LcmmDzmH2",
    "2OwwM8ToR9dx9RJ2sAKTcrLmCB92"
  ],
  "dependencies": [],
  "eventsFunctions": [],
  "eventsBasedBehaviors": [
    {
      "description": "Force the object to stay visible on the screen by setting back its position inside the viewport of the camera.",
      "fullName": "Stay on Screen",
      "name": "StayOnScreen",
      "objectType": "",
      "eventsFunctions": [
        {
          "fullName": "",
          "functionType": "Action",
          "name": "doStepPostEvents",
          "sentence": "",
          "events": [
            {
              "type": "BuiltinCommonInstructions::Standard",
              "conditions": [],
              "actions": [
                {
                  "type": {
                    "value": "MettreX"
                  },
                  "parameters": [
                    "Object",
                    "=",
                    "min(max(Object.X(), CameraX(Object.Layer(), 0) - CameraWidth(Object.Layer(), 0)/2 + Object.Behavior::PropertyMarginLeft()), CameraX(Object.Layer(), 0) + CameraWidth(Object.Layer(), 0)/2 - Object.Width() - Object.Behavior::PropertyMarginRight())"
                  ]
                },
                {
                  "type": {
                    "value": "MettreY"
                  },
                  "parameters": [
                    "Object",
                    "=",
                    "min(max(Object.Y(), CameraY(Object.Layer(), 0) - CameraHeight(Object.Layer(), 0)/2+ Object.Behavior::PropertyMarginTop()), CameraY(Object.Layer(), 0) + CameraHeight(Object.Layer(), 0)/2 - Object.Height() - Object.Behavior::PropertyMarginBottom())"
                  ]
                }
              ]
            }
          ],
          "parameters": [
            {
              "description": "Object",
              "name": "Object",
              "type": "object"
            },
            {
              "description": "Behavior",
              "name": "Behavior",
              "supplementaryInformation": "StayOnScreen::StayOnScreen",
              "type": "behavior"
            }
          ],
          "objectGroups": []
        }
      ],
      "propertyDescriptors": [
        {
          "value": "0",
          "type": "Number",
          "label": "Top margin, in pixels",
          "description": "",
          "group": "",
          "extraInformation": [],
          "hidden": false,
          "name": "MarginTop"
        },
        {
          "value": "0",
          "type": "Number",
          "label": "Bottom margin, in pixels",
          "description": "",
          "group": "",
          "extraInformation": [],
          "hidden": false,
          "name": "MarginBottom"
        },
        {
          "value": "0",
          "type": "Number",
          "label": "Left margin, in pixels",
          "description": "",
          "group": "",
          "extraInformation": [],
          "hidden": false,
          "name": "MarginLeft"
        },
        {
          "value": "0",
          "type": "Number",
          "label": "Right margin, in pixels",
          "description": "",
          "group": "",
          "extraInformation": [],
          "hidden": false,
          "name": "MarginRight"
        }
      ],
      "sharedPropertyDescriptors": []
    }
  ],
  "eventsBasedObjects": []
}